{% extends "disease_pipeline_template.html" %}

{% block pageName %}BioVenturist Report{% endblock %}

{% block queryScriptReport %}
<script type="text/javascript" src="/reports/static/js/disease_pipeline_edit.js"></script>
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript" src="/bvapp/static/js/ui.core.js"></script>
<script type="text/javascript" src="/bvapp/static/js/ui.tabs.js"></script>
<script type="text/javascript" src="/static/js/form_elements.js"></script>
<script type="text/javascript" src="/reports/static/js/direct_edit.js"></script>

<script language="javascript" type="text/javascript">

google.load("visualization", "1", {packages:["table"]});
google.load("visualization", "1", {packages:["imagebarchart"]});
google.load("visualization", "1", {packages:["columnchart"]});

function load_info() {
	perform_touch('{{ domain_used }}');
	
	var url_read = "http://{{ domain_used }}/api/service/mqlread";
	var url_write = "http://{{ domain_used }}/api/service/mqlwrite";
	
	//var type = '{{ bioventurist_domain }}'+'bv_medical_condition';
	//var matchType = '/medicine/disease';
	//test_type(url_read, '{{ domain_used }}', __DISEASE__NAME__, type,matchType,'disease');
	var topic_id = parseTopicID("{{ topic_id }}")
	get_content(url_read, url_write, '{{ domain_used }}','{{ bioventurist_domain }}', topic_id);
}

</script>
{% endblock %}

{% block col2_container %}
<script type="text/javascript">
	$(document).ready(function(){
		var input_html = $("input[name='html']");
		var div_report = $("#report");
		
		$("#tabbed-container ul").tabs();
		
		var url_convert = "http://bioventurist.appspot.com{% url reports.views.convert_images %}";
		
		function urlencode(str) { 
		  return escape(str).replace('+', '%2B').replace('%20', '+').replace('*', '%2A').replace('/', '%2F').replace('@', '%40'); 
		}
		
		$("input[type='submit']").click(function(){
			
			div_report.find("img").each(function(){
				var original_src = $(this).attr("src");
				$(this).attr("src", url_convert+"?src="+urlencode(original_src));
			});
			
			div_report.find("table").each(function(){
				$(this).attr("border", "1");
			});
			
			input_html.val(div_report.html());
			$("form").submit();
		});
		
		$("#create_pdf").ajaxStop(function(){
			$(this).show();
		});
		
	});
</script>

<center>
	<h1>BioVenturist Report - Pipeline analysis </h1>
	<br></br><br></br>
</center>

<div id="tabbed-container">
    <ul>
        <li><a href="#tab_report_intro"><span>Report Intro.</span></a></li>
        <li><a href="#tab_overview_text"><span>Overview</span></a></li>            
        <li><a href="#tab_disease"><span>Disease</span></a></li>
        <li><a href="#tab_treatment"><span>Treatment</span></a></li>
        <li><a href="#tab_companies"><span>Companies</span></a></li>            
        <li><a href="#tab_therapeutics"><span>Therapeutics</span></a></li>
        <li><a href="#tab_report"><span>Report</span></a></li>            
    </ul>
    
    <div id="tab_report_intro">
		<p><em>Welcome to the BioVenturist report generator.  The following gives a step-by-step on how to create a 
		report of drugs in development and on the market for the given disease.  Each tab walks you each type
		of data that needs to be added to the report.</em></p>
    	
    </div>

    <div id="tab_overview_text">
		<h3>Overview</h3>
		<p><em>Please enter introductory text about the disease, the market opportunity, and the competitive landscape.</em></p>
		<br />
		
		<div id="overview" class="overview">{{ report.overview|linebreaksbr }}</div>
		<a href="{% url reports.views.overview_update topic_id %}" onclick="javascript: return false;" class="overview_edit">[ Edit ]</a>
    </div>

    <div id="tab_disease">
    	<h3>Overview of Disease</h3>
		<p><em>Please enter overview blurb of the disease.</em></p>
		<br />
    	<div id="overview_disease" class="overview">{{ report.overview_desease|linebreaksbr }}</div>
		<a href="{% url reports.views.overview_update topic_id %}" onclick="javascript: return false;" class="overview_edit">[ Edit ]</a>
    	<br /><hr />
    	<h3>Symptoms</h3>
		<p><em>Please add the symptoms of the disease.</em></p>
		<br />
    	<div id="span_symptoms"></div>
    	<br /><hr />
    	<h3>Risk Factors</h3>
		<p><em>Please add the risk factors of the disease.</em></p>
		<br />
    	<div id="span_risk_factors"></div>
    	<br /><hr />
    	<h3>Stages</h3>
		<p><em>Please add the stages of the disease.</em></p>
		<br />
    	<div id="span_stages"></div>
    	<br /><hr />
    	<h3>Survival Rates</h3>
		<p><em>Please add the survival rates of the disease.</em></p>
		<br />
    	<div id="span_survival_rates"></div>
    	<br /><hr />
 
    </div>
    
    <div id="tab_treatment">
		<h3>Current Treatment</h3>
		<div id="current_treatment_blurb">
			<div id="treatment" class="overview">{{ report.treatment|linebreaksbr }}</div>
			<a href="{% url reports.views.overview_update topic_id %}" onclick="javascript: return false;" class="overview_edit">[ Edit ]</a>
		</div>
    	[Add treatment information]    
    </div>
    
    <div id="tab_companies">
    	<h3>Add all the companies involved in the disease:</h3>
    	<div id="span_company_involved"></div>
    	<h3>Edit information about each company:</h3>    
		<div id="companies_div"></div>    
    </div>
    
	<div id="tab_therapeutics">
		<h2> Therapeutics by Company </h2>
		<div id="Chart">
			<h3>Therapeutics by Stage of Development</h3>
			<div id="bar_chart2_div"></div>
			<br></br>
			<div id="bar_chart_div"></div>
			<br></br>
		</div>
		<div id="Table">
			<h3>Therapeutics by Stage of Development</h3>
			<br></br>
			<center>
				<div id="table_div"></div>
			</center>
		</div>
		<br></br><br></br>
    </div>
    
    <div id="tab_report">
    	[Under construction...]
    </div>    
</div>    

{% endblock %}
